/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package state;

import java.util.Iterator;
import java.util.LinkedList;

/**
 * A doubly linked list for storing and managing an animation's poses
 * @author Andrew Gratta <andrew.gratta@stonybrook.edu>
 */
public class PoseLinkedList extends LinkedList<Pose>{
    public Iterator<Pose> getCircularIterator()
    {
        return new CircularPoseIterator();
    }
    
    private class CircularPoseIterator implements Iterator<Pose>
    {
        int currentPosition = 0;
        
        @Override
        public boolean hasNext() {
            return !isEmpty();
        }

        @Override
        public Pose next() {
            Pose p = get(currentPosition);
            currentPosition = (currentPosition + 1) % size();
            return p;
        }

        @Override
        public void remove() {}
        
    }
}
